package com.itheima.dao;

import com.itheima.pojo.SysDictData;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;


public interface SysDictDataDao extends Mapper<SysDictData> {

    @Select("select uid FROM t_sys_dict_type where dict_type = #{dictType}")
    String selectDictTypeUidByDictType(@Param("dictType") String dictType);

    @Select("SELECT * FROM `t_sys_dict_data` where dict_type_uid = #{uid}")
    @Results({
            @Result(id = true,column = "uid",property = "uid"),
            @Result(column = "oid",property = "oid"),
            @Result(column = "dict_type_uid",property = "dictTypeUid"),
            @Result(column = "dict_label",property = "dictLabel"),
            @Result(column = "dict_value",property = "dictValue"),
            @Result(column = "css_class",property = "cssClass"),
            @Result(column = "list_class",property = "listClass"),
            @Result(column = "is_default",property = "isDefault"),
            @Result(column = "create_by_uid",property = "createByUid"),
            @Result(column = "update_by_uid",property = "updateByUid"),
            @Result(column = "remark",property = "remark"),
            @Result(column = "status",property = "status"),
            @Result(column = "create_time",property = "createTime"),
            @Result(column = "update_time",property = "updateTime"),
            @Result(column = "is_publish",property = "isPublish"),
            @Result(column = "sort",property = "sort")
    })
    List<SysDictData> getListByDictType(@Param("uid") String uid);

}
